<?php
/*
* Plugin Name: New Roles
* Plugin URI: http://aaron.jorb.in
* Description: Add link master role, and strip manage categories from editor
* Version: 0.0
* Author: Aaron Jorbin
* Author URI: http://aaron.jorb.in
 */
/*
 * 		Copywrite 2010 Aaron Jorbin (aaron@jorb.in)
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without weven the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


class jorbin_role_master{

	/**
	 * Add our init action
	 */
	function __construct(){
		add_action('init', array($this, 'init') );

	}
	/**
	 * Check to see if we need to do anything
	 *
	 */
	function init(){
		if ( FALSE === get_option('jorbin_role_master') ):
			$this->populate_role_1();
			add_option('jorbin_role_master', '1', '', 'yes');
		endif;
	}

	/**
	 * Initial role population for link master and strip editor of manage cats
	 *
	 */
	function populate_role_1(){
		add_role('link_master', 'Link Master');

		$role =& get_role('link_master');
		$role->add_cap('read');
		$role->add_cap('manage_links');
		$role->add_cap('read_private_posts');
		$role->add_cap('read_private_pages');

		$role =& get_role('editor');
		$role->remove_cap('manage_categories');

	}

}

$jorbin_role_master = new jorbin_role_master();
